/*2. 0218-0220_2.cpp(见群文件) 定义了一个用单链表实现的栈并进行了测试
请试着将该程序分为若干个文件（头文件(.h)，源代码文件(.cpp))，使程序代码更为清晰
*/

#include <cstdlib>
#include <iostream>
#include "20200218_usrStack_def.h"
using namespace std;
int main(int argc, char const *argv[])
{   
    Stack S;

    if (InitStack(S))  cout<<"栈 创建成功！"<<endl;
    else   cout<<"栈 创建失败！"<<endl;

    if(isEmpty(S)) cout<<"这是个空栈！"<<endl;
    else cout<<"此栈非空！"<<endl;

    int e=123;
    if(Push(S,e)) cout<<"元素"<<e<<" 入栈成功！"<<endl;
    else 
        cout<<e<<" 入栈失败！"<<endl;

    if(isEmpty(S)) cout<<"这是个空栈！"<<endl;
    else cout<<"此栈非空！"<<endl;

    int tmp = GetTop(S);
    cout<<"目前 S 的栈顶元素为："<<tmp<<endl;

    Pop(S);
    cout<<"出栈！"<<endl;

    if(isEmpty(S)) cout<<"这是个空栈！"<<endl;
    else cout<<"此栈非空！"<<endl;

    return 0;
}
